<template>
  <div id="app">
    <router-view></router-view>
    <myloading v-show="LOADING" class="loading"></myloading>
    <div style="height: 3rem"></div>
  </div>
</template>
<script>
import { mapState } from 'vuex'
import Myloading from './components/loading/vantUi.vue' //加载组件的位置
export default {
  name: 'app',
  components: { Myloading },
  computed: {
    ...mapState(['LOADING'])
  },
  data: function () {
    return {}
  },
  created() {
    // this.init()
  },
  methods: {
    init() {
      this.$axios({ url: '/cesi' }).then(res => {
        console.log(res)
      })
      setTimeout(function () {
        console.log('宏任务')
      })

      new Promise(resolve => {
        console.log('1 promise 1') //同步
        resolve()
      })
        .then(() => {
          console.log('微1')
        })
        .then(() => {
          console.log('微2')
        })
      console.log(2) //同步

      let date = new Date() // new Date(1998, 11, 16)
      let time = date.getTime() + 60 * 60
      date.setTime(time)
      document.cookie = `name=8848;expires=${date.toUTCString()}`
    }
  },
  mounted() {}
}
</script>
<style lang="less">
.loading {
  z-index: 2000000;
  // 遮罩层
  background: center;
  // background: rgba(0, 0, 0, 0.5);
}
</style>
